Skip to content

k-Nearest Neighbors (aolearn.knn)

predict_knn(X, y, k, query)

Predicts the class using the k-Nearest Neighbors algorithm.

Parameters:

  • X (table): Training features.
  • y (table): Training labels.
  • k (number): The number of neighbors to consider.
  • query (table): Features for the data point to be classified.

Returns:

  • any: Predicted class label.